//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package rent.hj.videoplayer.subTitle;

import java.io.InputStream;
import java.io.Reader;
import java.io.StreamTokenizer;

public class AssTokenizer extends StreamTokenizer {
    static int ASS_TEXT = -1;
    static int ASS_BRAKET = -2;
    static int ASS_EOF = -3;
    static int ASS_UNKNOWN = -5;
    boolean outsideTag = true;

    public AssTokenizer(Reader r) {
        super(r);
        this.resetSyntax();
        this.wordChars(0, 255);
        this.ordinaryChar(123);
        this.ordinaryChar(125);
    }

    public AssTokenizer(InputStream is) {
        super(is);
        this.resetSyntax();
        this.wordChars(0, 255);
        this.ordinaryChar(123);
        this.ordinaryChar(125);
    }

    public int nextAssText() {
        try {
            switch(this.nextToken()) {
                case -3:
                    if(this.sval.trim().length() == 0) {
                        return this.nextAssText();
                    } else if(this.outsideTag) {
                        return ASS_TEXT;
                    }
                default:
                    return ASS_UNKNOWN;
                case -1:
                    return ASS_EOF;
                case 123:
                    this.outsideTag = false;
                    return this.nextAssText();
                case 125:
                    this.outsideTag = true;
                    return this.nextAssText();
            }
        } catch (Exception var3) {
            return ASS_UNKNOWN;
        }
    }
}
